package edu.lit.cn.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.HashMap;
@Mapper
public interface InspectDataMapper {
    @ResultType(HashMap.class)
    @Select("SELECT DISTINCT(NAME),id FROM t_inspectdata")
    ArrayList<HashMap<String, Object>> getAll();
    @ResultType(HashMap.class)
    @Select("SELECT DISTINCT(a.name),id FROM t_inspectdata AS a WHERE a.detectitem=1 AND a.detectstd!='无异音'")
    ArrayList<HashMap<String, Object>> getAbnormal();
    @ResultType(HashMap.class)
    @Select("SELECT a.*,b.name \n" +
            "FROM t_mdata AS a\n" +
            "LEFT JOIN t_inspectdata AS b \n" +
            "ON a.inspectdataid=b.id\n" +
            "WHERE b.id=#{id};")
    ArrayList<HashMap<String, Object>> getAllInspectionInformation(int id);
}
